/*
 * @Author: zdc 3215400595@qq.com
 * @Date: 2023-07-30 08:45:09
 * @LastEditors: zdc 3215400595@qq.com
 * @LastEditTime: 2023-08-08 21:17:07
 * @FilePath: /Log_system/Logs_System/test.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 *
 */



#include "../Logs_System/tonglog.hpp"
void test_log()
{
    INFO("%s", "测试开始");

    tong_log::Logger::ptr logger = tong_log::getLogger("async_logger");
    logger->debug("%s", "测试日志");
    logger->info("%s", "测试日志");
    logger->warn("%s", "测试日志");
    logger->error("%s", "测试日志");
    logger->fatal("%s", "测试日志");

    INFO("%s", "测试完毕");

}
int main()
{
    std::unique_ptr<tong_log::LoggerBuilder> builder(new tong_log::GlobalLoggerBulider());

    builder->buildLoggerName("async_logger");
    builder->buildLoggerFormatter("[%d{%H:%M:%S}][%c][%f:%l][%p]%T%m%n");
    builder->buildLoggerType(tong_log::LoggerType::LOGGER_SYNC);
    builder->buildSink<tong_log::StdoutSink>();
    builder->buildSink<tong_log::FileSink>("./logfile/asynctest.log");
    builder->buildSink<tong_log::RollBySizeSink>("./logfile/roll-.log", 1024 * 1024);
    builder->buildLoggerLevel(tong_log::LogLevel::value::WARN);

    builder->build();

    test_log();
}

// void test_log()
// {
//     DEBUG("%s", "测试日志");
//     INFO("%s", "测试日志");
//     WARN("%s", "测试日志");
//     ERROR("%s", "测试日志");
//     FATAL("%s", "测试日志");
//     size_t count = 0;
//     while (count < 5000)
//     {
//         FATAL("测试日志-%d", count++);
//     }
// }
// int main()
// {
//     test_log();
// }
